package com.teach.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.teach.entity.user;
import com.teach.service.UserService;
import com.teach.service.impl.UserServiceImpl;

public class UserUpdateFormServlet extends HttpServlet{
	private UserService userService = new UserServiceImpl();
	
	
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		Integer userId;
		try{
			userId = Integer.valueOf(request.getParameter("userId"));
			
		}catch(Exception ex){
			throw new ServletException("参数错误", ex);
		}
		
	
			user u = userService.select(userId);
			request.setAttribute("user", u);
		
		request.getRequestDispatcher("/admin/user-update-form.jsp").forward(request, response);
		
	}
}
